<?php

namespace app\common\lib;
/**
 * 数据接口类
 */
class Show {
    /**
     * @param array $data
     * @param string $message
     * @param int $status
     * @return \think\response\Json
     */
    public static function success($data = [], $message = '请求成功', $status = 200) 
    {
        $result = [
            "data" => $data,
            'msg'=>$message,
            'status'=>$status
        ];
        return json($result);
    }

    /**
     * @param array $data
     * @param string $message
     * @param int $status
     * @return \think\response\Json
     */
    public static function error($message = '请求失败',  $status = 500 ,$data = []) {
        $result = [
            "data" => $data,
            'msg'=>$message,
            'status'=>$status
        ];

        return json($result);
    }
}